package com.xf.common.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 是或否
 *
 */
@Getter
@AllArgsConstructor
public enum YesOrNoEnum  {

	Unknown(-1L, "未知"), No(0L, "否"), Yes(1L, "是");

	private final Long value;

	private final String desc;

	public static YesOrNoEnum getValue(Long value) {
		if (value == null) {
			return null;
		}
		for (YesOrNoEnum status : YesOrNoEnum.values()) {
			if (status.getValue().equals(value)) {
				return status;
			}
		}
		return null;
	}

	public static String getDesc(Long value) {
		if (getValue(value) == null) {
			return null;
		}
		return getValue(value).getDesc();
	}

}
